'use strict';

module.exports = app => {
  const { router, controller: { area }, middleware: { validator, checkPageTable, checkParams } } = app;
  // const userExist = app.middleware.userExist();
  const baseUrl = '/api/area';
  router.get(baseUrl, checkPageTable(), area.index);
  router.get(baseUrl + '/:id', checkParams(), area.show);
  router.post(baseUrl, validator('area.create'), area.create);
  router.put(baseUrl + '/:id', checkParams(), validator('area.update'), area.update);
  router.delete(baseUrl + '/:id', checkParams(), area.destroy);
};
